cmake_minimum_required(VERSION 3.20)
project(scnsDemos-STM32F767IGT6_AlientekApollo C CXX ASM)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_STANDARD 99)

add_compile_options(-std=c99 -Wall)
add_compile_options(-Wno-padded -Wno-reserved-identifier -Wno-newline-eof -Wno-c11-extensions -Wno-gnu-zero-variadic-macro-arguments -Wno-static-in-inline -Wno-unknown-warning-option -Wno-double-promotion -Wno-declaration-after-statement -Wno-switch-enum -Wno-sign-conversion -Wno-implicit-int-conversion -Wno-implicit-float-conversion -Wno-unused-parameter -Wno-float-conversion -Wno-unused-function -Wno-unused-variable -Wno-missing-noreturn -Wno-strict-aliasing -Wno-unused-result -Wno-format)

if (CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
    add_compile_options(-g)
else ()
    add_compile_options(-Ofast)
endIF ()

IF (CMAKE_SYSTEM_NAME MATCHES "Generic")
    include_directories(Core/Src)
    include_directories(Core/Inc)
    include_directories(Drivers/test)
    include_directories(Drivers/STM32F7xx_HAL_Driver/Inc)
    include_directories(Drivers/CMSIS/Device/ST/STM32F7xx/Include)
    include_directories(Drivers/CMSIS/Include)
    include_directories(Drivers/STM32F7xx_HAL_Driver/Inc/Legacy)
    #SCNS
    include_directories(Drivers/hxPrintf)
    include_directories(Drivers/scns/src)
    include_directories(Drivers/scnsBsp/STM32F767IGT6_AlientekApollo)
    include_directories(Drivers/scnsBsp/scnsGpBspStm32)

    #Device
    add_subdirectory(Drivers/STM32F7xx_HAL_Driver)
    #SCNS
    add_subdirectory(Drivers/scnsBsp/scnsGpBspStm32)
    add_subdirectory(Drivers/scnsBsp/STM32F767IGT6_AlientekApollo)
    add_subdirectory(Drivers/scns)
    add_subdirectory(Drivers/hxPrintf)

    add_subdirectory(Core/Src/)
else ()
    include_directories(VM)
    #SCNS
    include_directories(Drivers/scnsBsp/windows)
    include_directories(Drivers/scns/src)
    #JCTO
    include_directories(Drivers/jcto)
    include_directories(Drivers/hxPrintf)

    #SCNS
    add_subdirectory(Drivers/scnsBsp/windows)
    add_subdirectory(Drivers/scns)
    #JCTO
    add_subdirectory(Drivers/jcto)
    add_subdirectory(Drivers/hxPrintf)

    link_libraries(m)

    add_subdirectory(VM/)
ENDIF ()
